Deleted unused files.
[Sonic-Engine-360.git] / GMS2 / Sonic Engine 360 / objects / DisplayCamera / Step_2.gml
blob6dadf3429272cbac1813786706240f0b43c87850
1 /// Display camera movement (note the view_object is set to this display camera in the Player creation code)\r
2 \r
3 with (Player)\r
4 {\r
5     if (action == act_death)  // Death code handled in first code piece, but still need to exit this step code when dead\r
6         return 0;\r
7 \r
8     if (action == act_lookdown && camera.ypan >= 0)\r
9         camera.ypan += 4;           // Pan the camera downwards (note the camera pan naturally moves 2 towards the center every step)\r
11     if (action == act_lookup && camera.ypan <= 0)\r
12         camera.ypan -= 4;           // Pan the camera upwards (note the camera pan naturally moves 2 towards the center every step)\r
14     // Set camera to Player position plus the camera pan (with a leniency of 60 before panning)\r
15     camera.x = x + max(0, abs(camera.xpan) - 60) * sign(camera.xpan);       \r
16     camera.y = y + max(0, abs(camera.ypan) - 60) * sign(camera.ypan);\r
18     // Move the camera pans toward the center each step if they are set\r
19     if (abs(camera.xpan) > 0)\r
20         camera.xpan = max(0, min(abs(camera.xpan) - 2, floor(__view_get( e__VW.XView, 0 )/2))) * sign(camera.xpan);\r
21     if (abs(camera.ypan) > 0)\r
22         camera.ypan = max(0, min(abs(camera.ypan) - 2, floor(__view_get( e__VW.HView, 0 )/2))) * sign(camera.ypan);\r
23 }\r